/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package za.co.pas.business.constant;

import java.awt.Component;
import javax.swing.JFrame;
import za.co.pas.business.mvc.BusinessMVC;

/**
 *
 * @author alabuschagne
 */
public class Constant
{
    public static BusinessMVC mvc = new BusinessMVC();

    public static JFrame getParentFrame(Component obj)
    {
        if (obj instanceof JFrame)
        {
            return (JFrame) obj;
        }
        else
        {
            if (obj.getParent() == null)
            {
                return null;
            }
            else
            {
                return getParentFrame(obj.getParent());
            }
        }
    }

    public static boolean stringCompare(String s1, String s2)
    {
        if((s1 == null) && (s2 == null))
        {
            return true;
        }
        else if((s1 == null) && (s2 != null))
        {
            return false;
        }
        else if((s1 != null) && (s2 == null))
        {
            return false;
        }
        else// (s1 != null) && (s2 != null)
        {
            return s1.compareTo(s2) == 0;
        }
    }

    public static boolean booleanCompare(Boolean b1, Boolean b2)
    {
        if((b1 == null) && (b2 == null))
        {
            return true;
        }
        else if((b1 == null) && (b2 != null))
        {
            return false;
        }
        else if((b1 != null) && (b2 == null))
        {
            return false;
        }
        else// (s1 != null) && (s2 != null)
        {
            return b1.compareTo(b2) == 0;
        }
    }
}
